<?php
/**
 * pm职级图表
 */
apf_require_controller("Abstract");
apf_require_class("Bll_Report_Report");
class Report_GradeController extends AbstractController {

    public function handle_request() {
        $report_bll = new Bll_Report_Report();
        //获取权限城市+部门
        $count = $report_bll->check_view_auth($this->user_info['user_id']);
        if(!$count){
            $this->show_tips('ERROR_AUTH');
        }
        $list = $report_bll->get_pm_by_dep_auth($this->user_info['user_id']);

        $data=array();
        if(!empty($list['P'])){
            $p_list = Const_User::get_p_degree();
            foreach($p_list as $p=>$val){
                if($p==99){
                    $p=0;
                }
                if(!empty($list['P']['P'.$p])){
                    $data['P']['P'.$p] = $list['P']['P'.$p];
                }
            }
        }
        if(!empty($list['M'])){
            $m_list = Const_User::get_p_degree();
            foreach($m_list as $m=>$val){
                if($m==99){
                    $m=0;
                }
                if(!empty($list['M']['M'.$m])){
                    $data['M']['M'.$m] = $list['M']['M'.$m];
                }
            }
        }
        $data['max'] = $list['max'];
        $data['p_num'] = $list['p_num'];
        $data['m_num'] = $list['m_num'];
        $this->request->set_attribute('data', $data);

        return "Report_Grade";
    }
}